package com.cssy.xxkj.logic.dao.impl;

import com.cssy.xxkj.logic.dao.LogicAllocatInwhDAO;
import com.cssy.xxkj.logic.entity.LogicAllocatInwhDO;
import com.plat.helper.SearchConditions;

import java.util.List;

import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

/**
 * 数据访问对象实现类
 * @since 2014-09-27
 */
public class LogicAllocatInwhDAOImpl extends SqlMapClientDaoSupport implements LogicAllocatInwhDAO {

    /**
     * 插入数据
     * @param logicAllocatInwhDO
     * @return 插入数据的主键
     */
    public String insertLogicAllocatInwhDO(LogicAllocatInwhDO logicAllocatInwhDO) {
        Object id = getSqlMapClientTemplate().insert("LogicAllocatInwh.insert", logicAllocatInwhDO);
        return (String) id;
    }

    /**
     * 统计记录数
     * @param logicAllocatInwhDO
     * @return 查出的记录数
     */
    public Integer countLogicAllocatInwhDOByExample(LogicAllocatInwhDO logicAllocatInwhDO) {
        Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicAllocatInwh.countByDOExample", logicAllocatInwhDO);
        return count;
    }

    /**
     * 更新记录
     * @param logicAllocatInwhDO
     * @return 受影响的行数
     */
    public Integer updateLogicAllocatInwhDO(LogicAllocatInwhDO logicAllocatInwhDO) {
        int result = getSqlMapClientTemplate().update("LogicAllocatInwh.update", logicAllocatInwhDO);
        return result;
    }

    /**
     * 获取对象列表
     * @param logicAllocatInwhDO
     * @return 对象列表
     */
    @SuppressWarnings("unchecked")
    public List<LogicAllocatInwhDO> findListByExample(LogicAllocatInwhDO logicAllocatInwhDO) {
        List<LogicAllocatInwhDO> list = getSqlMapClientTemplate().queryForList("LogicAllocatInwh.findListByDO", logicAllocatInwhDO);
        return list;
    }

    /**
     * 根据主键获取logicAllocatInwhDO
     * @param id
     * @return logicAllocatInwhDO
     */
    public LogicAllocatInwhDO findLogicAllocatInwhDOByPrimaryKey(String id) {
        LogicAllocatInwhDO logicAllocatInwhDO = (LogicAllocatInwhDO) getSqlMapClientTemplate().queryForObject("LogicAllocatInwh.findByPrimaryKey", id);
        return logicAllocatInwhDO;
    }

    /**
     * 删除记录
     * @param id
     * @return 受影响的行数
     */
    public Integer deleteLogicAllocatInwhDOByPrimaryKey(String id) {
        Integer rows = (Integer) getSqlMapClientTemplate().delete("LogicAllocatInwh.deleteByPrimaryKey", id);
        return rows;
    }

    /**
     * 查询调拨接收所有记录集合
     */
	@Override
	public List<LogicAllocatInwhDO> find(SearchConditions scs)
			throws DataAccessException {
		List<LogicAllocatInwhDO> result = getSqlMapClientTemplate().queryForList("LogicAllocatInwh_ex.find", scs);
		return result;
	}

	/**
     * 查询调拨接收所有记录条数
     */
	@Override
	public Integer count(SearchConditions scs) throws DataAccessException {
		Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicAllocatInwh_ex.count", scs);
        return count;
	}

	/**
	 * 逻辑删除，不删除数据
	 */
	@Override
	public Integer deleteBizRemoved(String id) throws DataAccessException {
		Integer count = (Integer) getSqlMapClientTemplate().update("LogicAllocatInwh_ex.deleteBizRemoved", id);
        return count;
	}

}